using System;

namespace facade.Singleton
{
    /// <summary>
    /// 饿汉模式
    /// </summary>
    public class Singleton
    {
        private Singleton()
        {

        }

        private static Singleton singleObj=new Singleton();
        public static Singleton GetSingleton()
        {
            lock (singleObj)
            {
                if (singleObj == null)
                {
                    singleObj= new Singleton();
                }
                return singleObj;
            }
        }
    }
}